package com.etheart.model.entity;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.search.annotations.AnalyzerDef;
import org.hibernate.search.annotations.ContainedIn;
import org.hibernate.search.annotations.DocumentId;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Index;
import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.NumericField;
import org.hibernate.search.annotations.Similarity;
import org.hibernate.search.annotations.Store;
import org.hibernate.search.annotations.TokenizerDef;
import org.wltea.analyzer.lucene.IKSimilarity;
import org.wltea.analyzer.solr.IKTokenizerFactory;

/**
 * Singer entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "_singer", catalog = "etheart")
@Indexed
@AnalyzerDef(name = "customanalyzer_singer",
		tokenizer = @TokenizerDef(factory = IKTokenizerFactory.class))
@Similarity(impl=IKSimilarity.class)
public class Singer implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	@Id
	@GeneratedValue
	@Column(name = "id", unique = true, nullable = false)
	@DocumentId
	@Field(index = Index.UN_TOKENIZED, store = Store.NO)
	@NumericField
	private Long id;
	
	@Field(index = Index.TOKENIZED, store = Store.NO)
	@Column
	private String singername;
	
	@Field(index = Index.TOKENIZED, store = Store.NO)
	@Column
	private String byname;
	
	@Field(index = Index.UN_TOKENIZED, store = Store.NO)
	@NumericField
	@Column
	private Long teamid;
	
	@Field(index = Index.TOKENIZED, store = Store.NO)
	@Column(name = "singerintro", length = 65535)
	private String singerintro;
	
	@Column(name = "net_id", length = 30)
	private String netId;
	
	@Column(name = "picture")
	private String picture;
	
	@Field(index = Index.UN_TOKENIZED, store = Store.NO)
	private int rank;
	@Field(index = Index.UN_TOKENIZED, store = Store.NO)
	@Column(name = "_area", length = 20)
	private String area;
	@Field(index = Index.UN_TOKENIZED, store = Store.NO)
	@Column(name = "sex", length = 10)
	private String sex;
	@Field(index = Index.TOKENIZED, store = Store.NO)
	@Column(name = "_type", length = 10)
	private String type;
	@Column(name = "is_team")
	private boolean isTeam;
	
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "singer")
	@ContainedIn
	private Set<Song> songs = new HashSet<Song>(0);
	
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "singer")
	@ContainedIn
	private Set<Album> albums = new HashSet<Album>(0);

	// Constructors

	/** default constructor */
	public Singer() {
	}

	

	// Property accessors
	
	public Long getId() {
		return this.id;
	}

	
	public void setId(Long id) {
		this.id = id;
	}
	
	
	public String getSex() {
		return sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}
	
	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}
	
	public boolean isTeam() {
		return isTeam;
	}

	public void setTeam(boolean isTeam) {
		this.isTeam = isTeam;
	}

	
	public String getArea() {
		return area;
	}

	

	public void setArea(String area) {
		this.area = area;
	}

	
	public int getRank() {
		return rank;
	}
	public void setRank(int rank) {
		this.rank = rank;
	}


	public String getNetId() {
		return netId;
	}

	public void setNetId(String netId) {
		this.netId = netId;
	}
	public String getSingername() {
		return this.singername;
	}

	public void setSingername(String singername) {
		this.singername = singername;
	}

	public String getByname() {
		return this.byname;
	}


	

	public void setByname(String byname) {
		this.byname = byname;
	}


	public Long getTeamid() {
		return this.teamid;
	}

	public void setTeamid(Long teamid) {
		this.teamid = teamid;
	}

	public String getSingerintro() {
		return this.singerintro;
	}

	public void setSingerintro(String singerintro) {
		this.singerintro = singerintro;
	}


	
	
	public String getPicture() {
		return picture;
	}



	public void setPicture(String picture) {
		this.picture = picture;
	}



	public Set<Song> getSongs() {
		return this.songs;
	}

	public void setSongs(Set<Song> songs) {
		this.songs = songs;
	}

	
	public Set<Album> getAlbums() {
		return this.albums;
	}

	public void setAlbums(Set<Album> albums) {
		this.albums = albums;
	}

}